//
//  TWLabel+ChangeLineSpaceAndWordSpace.swift
//  EyepetizerImitative
//
//  Created by 田伟 on 2017/4/5.
//  Copyright © 2017年 个人. All rights reserved.
//

import UIKit

class TWLabel_ChangeLineSpaceAndWordSpace: UILabel {

    // MARK:- 改变行间距
    class func changeLineSpaceForLabel(label : UILabel, space : CGFloat) {
        let labelText = label.text
        let attributedString : NSMutableAttributedString = NSMutableAttributedString(string: labelText!)
        let paragraphStyle : NSMutableParagraphStyle = NSMutableParagraphStyle()
        paragraphStyle.lineSpacing = space
        attributedString.addAttributes([NSParagraphStyleAttributeName : paragraphStyle], range: NSRange(location: 0, length: (labelText?.characters.count)!))
        label.attributedText = attributedString;
        label.sizeToFit()
    }
}
